package com.spa.infrastructure.repository.service;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.github.yulichang.base.MPJBaseServiceImpl;
import com.spa.infrastructure.repository.mapper.SConfigurationMapper;
import com.spa.infrastructure.repository.po.SysConfigurationPO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;
import java.util.List;

@Component
@Slf4j
public class SysConfigurationRepositoryService extends MPJBaseServiceImpl<SConfigurationMapper, SysConfigurationPO> {

    @Resource
    private SConfigurationMapper sConfigurationMapper;

    public void add(SysConfigurationPO po) {
        sConfigurationMapper.insert(po);
    }

    public List<String> getValueByKey(String key) {
        QueryWrapper<SysConfigurationPO> wrapper = new QueryWrapper<>();
        wrapper.eq("key_word", key);
        return sConfigurationMapper.selectList(wrapper).stream().map(SysConfigurationPO::getValue).toList();
    }

}
